package com.clw.template.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.clw.template.enums.MenuEnum;
import com.clw.template.mybatis.JsonIntegerArrayTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 权限表
 * </p>
 *
 * @author clw
 * @since 2019-11-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="SysPermission对象", description="权限表")
@TableName(value = "sys_permission",autoResultMap = true)
public class SysPermission implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "上级id(0为顶级)")
    private Long pId;

    @ApiModelProperty(value = "类型（0->目录,1->菜单,2->按钮,3->其它）")
    private MenuEnum type;

    @ApiModelProperty(value = "名称")
    private String name;

    @ApiModelProperty(value = "权限")
    private String permission;

    @TableField(typeHandler = JsonIntegerArrayTypeHandler.class)
    @ApiModelProperty(value = "选中的数组（给前端提供）")
    private Integer[] selected;

    @ApiModelProperty(value = "创建时间")
    private LocalDateTime addTime;

    @ApiModelProperty(value = "更新时间")
    private LocalDateTime updateTime;

}
